.TH libaufs 3
.SH NAME
aufs_add_branch \- Adds a branch to a union.
.PP
aufs_remove_branch \- Removes a branch from a union.
.PP
aufs_set_perms \- Sets the permissions on a union branch.
.PP
aufs_is_writable \- Finds out if a branch of a union is writable.
.PP
aufs_get_branchstring \- Returns the branchstring of a union.
.PP
aufs_first_branch \- Returns the path of the first branch in a union.
.PP
aufs_next_branch \- Returns the path of the next branch in a union.
.PP
aufs_get_index \- Returns the index of a branch in a union.
.PP
aufs_create_union \- Creates a new union.
.SH SYNOPSYS
int aufs_add_branch(char *unionpath, char *branchpath, int writable, char *before);
.PP
int aufs_remove_branch(char *unionpath, char *branchpath);
.PP
int aufs_set_perms(char *unionpath, char *branchpath, int writable);
.PP
int aufs_is_writable(char *unionpath, char *branchpath);
.PP
char *aufs_get_branchstring(char *unionpath);
.PP
char *aufs_first_branch(char *unionpath, char **branchstring);
.PP
char *aufs_next_branch(char **branchstring);
.PP
int aufs_get_index(char *unionpath, char *branchpath);
.PP
int aufs_create_union(char *unionpath);
.SH DESCRIPTION
These functions are used to manipulate aufs unions.
.PP
.B aufs_add_branch 
\- Adds branch 
.B branchpath 
to union 
.B unionpath.
before the branch
.B before.

If 
.B writable 
is 1, then the branch is writable, if it is 0, then it is not writable
.PP
.B aufs_remove_branch 
\- Removes branch
.B branchpath
from union
.B unionpath
.PP
.B aufs_set_perms 
\- Sets branch
.B branchpath
in union
.B unionpath
to be writable if 
.B writable
is 1
and read-only if 
.B writable
is 0
.PP
.B aufs_is_writable
\- Detects if branch
.B branchpath
of union
.B unionpath
is writable.

Returns 1 if it is, 0 if it is not.
.PP
.B aufs_get_branchstring
\- Retrieves the branchstring for the union
.B unionpath
.PP
.B aufs_first_branch
\- Retrieves the path of the first branch in union
.B unionpath.

.B branchstring is used to store the branchstring of the union. It does not need to be set, but will need to be passed to aufs_next_branch to continue reading branches.
.PP
.B aufs_next_branch
\- Retrieves the next branch of a union, branchstring should be the same pointer given to 
.B aufs_first_branch.
.PP
.B aufs_get_index
\- Gets the index of branch
.B branchpath
in union
.B unionpath.

Return value is the index, or <0 on failure.
.PP
.B aufs_create_union
\- Creates an aufs union at
.B unionpath
.SH EXAMPLES
.nf
#include <unionfs.h>

/* Get the branch number of a particular branch */
int branch_number; 
branch_number = union_get_branch("/union", "/branch");
/* Do something with this information */


/* Print out information for all branches. */
int num_branches, i;
union_branch *branches;
num_branches = union_get_branches("/union", &branches);
for (i = 0; i <  num_branches; i++)
	printf("branch_number: %d, branch_path: %s, perms: %d\n", i, 
		branches[i].path, branches[i].perms);



/*Add as last branch*/
union_add("/union", "/branch", -1, MAY_READ); 

/*Adds as first branch*/
union_add("/union", "/branch", 0, MAY_READ | MAY_WRITE); 

/*Adds before branch2*/
union_add("/union", "/branch", union_get_branch("/union", "/branch2"), 
		MAY_READ); 

/*Remove first branch*/
union_del("/union", 0) 

/*Remove /branch*/
union_del("/union", union_get_branch("/union", "/branch")) 
.fn
.SH FILES
/proc/mounts used for branch info.

.SH AUTHOR
Written in current, library form by Sassan Panahinejad (ico2).
.PP
Based on the origional unionctl utility by:
Erez Zadok, Charles P. Wright, Josef Sipek, Arun M. Krishnakumar,
David P. Quigley, Mohammad Nayyer Zubair, Puja Gupta,
Harikesavan Krishnan, Stony Brook University, 
The Research Foundation of State University of New York